var b ={
    name:'aa',
    // a:function (){
    //     console.log(this.name);
    // }
}
function a(){
    console.log(this.name);
}

// a.call(b)//b.a()

//a.test()

Function.prototype.mycall = function(context){
    //调用call的是this
    this
    if(typeof this !== 'function'){
        //如果调用我的不是个函数,就报错
        throw new TypeError('Error')
    }
    context = context || window

    const args =[...arguments].slice(1)

    //把调用我的那个函数获取到，复制到context对象中去
    context.fn = this

    context.fn(...args)
    delete context.fn
}

a.mycall(b,1,2)